package ecs

import (
	"tushare/model/aliyun/ecs"

	"strconv"
	"tushare/common"

	"github.com/gin-gonic/gin"
)

func EcsList(c *gin.Context) ([]ecs.AliyunEcs, int64) {
	page, _ := strconv.ParseInt(c.Query("page"), 10, 64)
	pageSize, _ := strconv.ParseInt(c.Query("pageSize"), 10, 64)

	us := new(common.UserSession)
	userInfo := us.GetUserInfo(c)
	list := ecs.AliyunEcsList(page, pageSize, userInfo.Id)
	count := ecs.AliyunEcsCount(userInfo.Id)
	return list, count
}
